Welcome to Ruby on rails Tutorials. Ruby on Rails is an extremely productive web application framework written in Ruby by David Heinemeier Hansson. This tutorial gives you a complete understanding of Ruby on Rails.
In addition to Ruby on rails tutorials, we will cover common interview questions and issues of Ruby on Rails.
Ruby is a programming language. It was created 20 years ago by Yukihiro “Matz” Matsumoto. By most measures of programming language popularity, Ruby ranks among the top ten, though usually as tenth (or so) in popularity, and largely due to the popularity of Rails. Like Java or the C language, Ruby is a general-purpose programming language, though it is best known for its use in web programming.
Ruby is the successful combination of Smalltalk conceptual elegance, Python's ease of use and learning, and Perl's pragmatism.
Ruby is a high-level programming language which Interpreted like Perl, Python, Tcl/TK, and Object-oriented like Smalltalk, Eiffel, Ada, Java.
Rails is a software library that extends the Ruby programming language. David Heinemeier Hansson is its creator. He gave it the name “Ruby on Rails,” though it is often just called “Rails.” Rails Strengths is packed with features that make you more productive, with many of the following features building on one other.
Inclined to build a profession as Ruby on Rails Developer? Then here is the blog post on, explore Ruby on RailsTraining
Here is a sample Ruby code to print "Hello Ruby"
# The Hello Class class Hello def initialize( name ) @name = name.capitalize end def salute puts "Hello #{@name}!" end end # Create a new object h = Hello.new("Ruby") # Output "Hello Ruby!" h.salute Output − This will produce the following result
Hello Ruby!
<% page_title = "Demonstration of ERB" %> <% salutation = "Dear programmer," %> <html> <head> <title><%= page_title %></title> </head> <body> <p><%= salutation %></p> <p>This is an example of how ERB fills out a template.</p> </body> </html>
Now, run the program using the command-line utility erb
tp> erb erb demo.rb
This will produce the following result −
<html> <head> <title>Demonstration of ERb</title> </head> <body> <p>Dear programmer,</p> <p>This is an example of how ERb fills out a template.</p> </body> </html>
A recommended workflow for creating Rails Application is as follows −
First, check if you already have Ruby installed. Open the command prompt and type ruby -v. If Ruby responds, and if it shows a version number at or above 2.2.2, then type gem --version. If you don't get an error, skip the Install Ruby step. Otherwise, we'll install a fresh Ruby.
If Ruby is not installed, then download an installation package from rubyinstaller.org. Follow the download link, and run the resulting installer. This is an exe file rubyinstaller-2.2.2.x.exe and will be installed in a single click. It's a very small package, and you'll get RubyGems as well along with this package. Please check the Release Notes for more detail.
Ruby on Rails Interview Questions
Install Rails − With Rubygems loaded, you can install all of the Rails and its dependencies using the following command through the command line.
C:> gem install rails
Note − The above command may take some time to install all dependencies. Make sure you are connected to the internet while installing gems dependencies
Use the following command to check the rails version.
C:> rails -v
Rails 4.2.4
First, we define a default value for all environments in config/application.rb
:
module
Configurator
class
Application < Rails::Application
# By default, let OSX resolve the path to the binary
config.wkhtmltopdf =
"wkhtmltopdf"
end
end
config/environments/
:Configurator::Application.configure
do
# Settings specified here will take precedence over those in config/application.rb
# Point Heroku explicitly to the binary we need to use
config.wkhtmltopdf =
"#{Rails.root}/bin/wkhtmltopdf"
end
config
to store your own configuration elements. They’re trivial to set, trivial to access, and require no third-party gems or custom text files.
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.